import http from 'libs/http';

// 学生登陆验证码
export const getStuLoginValidCode = success => {
  const url = '/student/getLoginValidCode';
  http.get(url).then(success)
}

// 学生登陆
export const studentLogin = (data, success, error) => {
  const url = '/student/login';
  http.post(url, data).then(success).catch(error)
};

export const validateMobilePhone = (data, success) => {
  const url = '/student/common/validMobile'
  http.get(url, data).then(success)
}

// 学生短信登陆验证码
export const getLoginSmsCode = (data, success, error) => {
  const url = '/student/sendLoginSmsCode'
  http.post(url, data).then(success).catch(error)
}

// 学生注册图形验证码
export const getStuRegValidCode = success => {
  const url = '/student/getRegisterValidCode';
  http.get(url).then(success)
}

// 学生注册手机验证码
export const getMobilePhoneValidCode = (data, success, error) => {
  const url = '/student/sendSmsCode';
  const showErrorNotice = false;
  http.post(url, data, {}, showErrorNotice).then(success).catch(error)
}

// 学生注册
export const studentRegistry = (data, success, error) => {
  const url = '/student/register';
  const showErrorNotice = false
  http.post(url, data, {}, showErrorNotice).then(success).catch(error)
}

export const getStuForgetValidCode = success => {
  const url = '/student/getForgetValidCode'
  http.get(url).then(success)
}

export const sendForgetPasswordSmsCode = (data, success, error) => {
  const url = '/student/sendForgetPasswordSmsCode';
  http.post(url, data).then(success).catch(error)
}

export const saveStuNewPassword = (data, success, error) => {
  const url = '/student/saveNewPassword'
  const showErrorNotice = false
  http.post(url, data, {}, showErrorNotice).then(res => { success(res) }).catch(error)
}

export const studentLogout = success => {
  const url = '/student/logOut'
  http.post(url).then(success)
}

